const LOOKUP_SERVICE_HOST = 'lookup-service.whitehatgaming.com'; $(document).ready(function () { /** In order to override the below Cookie Banner html, please define `window.cookieNoticeHtml` on specific site. @note Don't forget to add `id="CookieNoticeContainer"` to principal div, also `cookieNoticeGrantConsent()` and` closeCookieNoticePopup()` on buttons clicks. @example // on jsutils.php or any js file window.cookieNoticeHtml = `
" + successMessage + "
", "true", "false", null, buttonText, returnUrl ); } else { if (!alert(successMessage)) { window.location.href = returnUrl; } } var currentLimit = data["current_loss_limit"]; $("#limitCurrent").html("Current Deposit Limit : " + currentLimit); $("#period").attr("value", data?.rglosslimit?.period); $("#value").attr("value", data?.rglosslimit?.value); }) .fail(function (er) { console.warn("error:", er); toggleFields(false); }); }; if (isConfirm) { confirmSuccess = data.status; } if (isUpdate) { if (data.cooloff != 1) { updateCurrentDepositLimit(); } else { $("#editlimits") .find("input, select") .each(function () { $(this).attr("disabled", "disabled"); }); popup( "300", lossLimitTranslations[lang].titleCoolOff, "", "true", "false", "false", null, "/account" ); } } else { $("#pendingAndCoolOff").hide(); // Enable all fields if (is_mobile) { $("#editlimits .deposit-limits-fields-container") .find(".input-div>div>div, .input-div>input, .action>div") .each(function () { $(this).attr("aria-disabled", "false"); $(this).removeClass("ui-disabled"); }); } $("#editlimits") .find("input, select") .each(function () { $(this).removeAttr("disabled"); }); } } else { $(".deposit-limits-fields-container #edit-status").addClass("error").removeClass("success"); } } continueToNormalFlow(); }) .fail(function (data) { hideMainLoader(); setStatusMsg("edit-status", "Internal error has occured, please contact support", false); console.warn("error:", data); }); }; var _this = this; var isInIframe = window.location != window.parent.location, targetDocument = isInIframe ? window.parent.document : window.document; if ($(this).attr("id").indexOf("cancellimits") > -1 || $(this).attr("id").indexOf("confirmlimits") > -1) { var message = '"; popup("300", lossLimitTranslations[lang].areYouSureTitle, message, "false"); var isInIframe = window.location != window.parent.location, targetDocument = isInIframe ? window.parent.document : window.document; $("#popupConfirmCancelDepositLimit a", targetDocument).click((e) => { e.preventDefault(); doSubmit.call($(_this)); $('#popupBox', targetDocument).remove(); $('#overlay', targetDocument).hide(); }); $("#popupCancelCancelDepositLimit a", targetDocument).click((e) => { e.preventDefault(); $('#popupBox', targetDocument).remove(); $('#overlay', targetDocument).hide(); }); } else { doSubmit.call($(_this)); } }); }); function toggleFields(disableFields = true) { LOSS_LIMITS_FIELDS.forEach((field) => { $(field).prop("disabled", disableFields); }); $("#editlimits #loading-button").toggle(); $("#editlimits #generic-submit").toggle(); } $(document).ready(() => { if (window.location.href.includes("page=unsubscribe") || $('body').data('whg-page-id') === 'unsubscribe') { const urlParams = new URLSearchParams(window.location.search); const type = urlParams.get("type"); const token = urlParams.get("token"); if (!token || !type) { window.location.href = "/"; } else { checkUnsubscribeType(type); unsubscribeEmail(type, token); } } $("#unsubscribe-form button").attr("disabled", true); $("#unsubscribe-form").submit((e) => { e.preventDefault(); const type = $(this).data("type"); const token = $(this).data("token"); const preference = $(this).serializeArray()[0].value; const payload = { token: token, marketingPrefs: {}, }; if (preference === "all") { payload.marketingPrefs.crossMarketing = {}; payload.marketingPrefs.brandMarketing = {}; payload.marketingPrefs.brandMarketing[type] = false; payload.marketingPrefs.crossMarketing[type] = false; } else { payload.marketingPrefs[preference] = {}; payload.marketingPrefs[preference][type] = false; } callPlatformAPI("user-marketing-update", payload).then((response) => { if (response.type === "error") { showMarketingError(response.message); return; } $("#unsubscribe-step-1").addClass("hidden"); $("#unsubscribe-step-2").removeClass("hidden"); }); }); $("#unsubscribe-form input").change((event) => { $('#unsubscribe-form button[type="submit"]').removeAttr("disabled"); }); }); function unsubscribeEmail(type, token) { // Define mapping of unsubscribe types to their corresponding preference key and channel const UNSUBSCRIBE_TYPE_CONFIG = { email: { preferenceKey: 'brandMarketing', channel: 'email' }, xemail: { preferenceKey: 'crossMarketing', channel: 'email' }, cross: { preferenceKey: 'crossMarketing', channel: 'email' }, sportsemail: { preferenceKey: 'sportsBrandMarketing', channel: 'email' }, sportscross: { preferenceKey: 'sportsCrossMarketing', channel: 'email' }, sms: { preferenceKey: 'brandMarketing', channel: 'sms' }, crosssms: { preferenceKey: 'crossMarketing', channel: 'sms' }, sportssms: { preferenceKey: 'sportsBrandMarketing', channel: 'sms' }, sportscrosssms: { preferenceKey: 'sportsCrossMarketing', channel: 'sms' } }; const config = UNSUBSCRIBE_TYPE_CONFIG[type]; if (!config) { console.warn('[unsubscribeEmail] type not supported', type); return }; const payload = { token: token, marketingPrefs: { [config.preferenceKey]: { [config.channel]: false, } } }; callPlatformAPI("user-marketing-update", payload).then((response) => { if (response.type === "error") { showMarketingError(response.message); return; } showSuccessMessage(); }); } function checkUnsubscribeType(type) { const validEmailTypes = ['email', 'cross', 'sportsemail', 'sportscross']; const validSmsTypes = ['sms', 'crosssms', 'sportssms', 'sportscrosssms']; if (validEmailTypes.includes(type) || validSmsTypes.includes(type)) { return $("#unsubscribe-email").show(); } if (type === "xemail") { return $("#unsubscribe-xemail").show(); } $("#unsubscribe-container").show(); } function showMarketingError(msg) { $(".marketing_prefs_error_msg").append(msg); $(".marketing_prefs_error").show(); $(".email-container").hide(); } function showSuccessMessage() { $(".email-success").show(); } $(document).ready(function() { // Block checking an email/phone channel when the contact field is not yet set $('body').on('change', '#user-marketing-preferences input[type=checkbox]', function() { if (!window.contactMissingFields || !$(this).prop('checked')) { return; } var missing = window.contactMissingFields; var isEmailChannel = $(this).attr('name') === 'receiveEmail'; var isPhoneChannel = $(this).attr('name') === 'receiveSms' || $(this).attr('name') === 'receivePhone'; if ((isEmailChannel && missing.email) || (isPhoneChannel && missing.phone)) { $(this).prop('checked', false); var msg = isEmailChannel ? missing.errorEmail : missing.errorPhone; $('#marketing-preferences-status').text(msg).css('color', '#d32f2f').show(); $('#contact-input-section').show(); } }); // Update user notifications $('body').on('submit', '#user-marketing-preferences', function(event) { event.preventDefault(); $('#edit-notification-status').text(""); showMainLoader(); var brandMarketingFields = $('fieldset[name=brand-marketing-preferences]'); var crossMarketingFields = $('fieldset[name=cross-marketing-preferences]'); var formData = { marketingPrefs: { brandMarketing: { sms: $('input[name=receiveSms]', brandMarketingFields).prop('checked'), phone: $('input[name=receivePhone]', brandMarketingFields).prop('checked'), post: $('input[name=receivePost]', brandMarketingFields).prop('checked'), email: $('input[name=receiveEmail]', brandMarketingFields).prop('checked'), }, crossMarketing: { sms: $('input[name=receiveSms]', crossMarketingFields).prop('checked'), phone: $('input[name=receivePhone]', crossMarketingFields).prop('checked'), post: $('input[name=receivePost]', crossMarketingFields).prop('checked'), email: $('input[name=receiveEmail]', crossMarketingFields).prop('checked'), } } } callPlatformAPI('user-marketing-update', formData).then((response) => { if (response.type === 'error'){ return showMarketingError(response.message, response.code); } if ($('#user-marketing-preferences .action > div').length) { $('#user-marketing-preferences .action > div').addClass('ui-disabled'); } else { $('#user-marketing-preferences input[type="submit"]').attr('disabled', true); } setStatusMsg("marketing-preferences-status", "Your account details have been successfully updated.", true); }) .fail(function() { setStatusMsg("marketing-preferences-status", "There was a problem updating your account details.
Error: Unknown
", true); }) .always(function() { hideMainLoader(); }) }); function showMarketingError(msgFallback, code){ const errorMessages = { 306: "Preference not saved: email and/or phone is missing. Please add your details before updating your communication preferences.", 307: "Preference not saved: email and/or phone is missing. Please add your details before updating your communication preferences." } const message = errorMessages[code] || msgFallback const prefixMessage = "There was a problem updating your account details.
Error:
" setStatusMsg("marketing-preferences-status", prefixMessage + message, true); } }); $(document).ready(function(){ var crossDiv = $(".marketing_prefs_cross_hide"); var sureDiv = $('#marketing_prefs_optout_check'); var stepCookie = 'marketing_prefs_email'; //Check if stepCookie is set and skip first step if so. var cookieVal = getCookie(stepCookie); if(typeof cookieVal != 'undefined'){ $("input[name=email][value=" + cookieVal + "]").prop('checked', true); $('#marketing_prefs_laws').hide(); $('#marketing_prefs_part1').hide(); $('#marketing_prefs_part2').show(); } //Marketing prefs clicked - show hide cross marketing form. $(".optin").change(function() { var showCross = false; $('input.optin:checkbox').each(function(){ if(this.checked){ showCross = true; return; } }); if(showCross){ crossDiv.show(); sureDiv.hide(); updateMarketingCheckboxes($('#optout')); toggleMarketingSubmit($('input:radio[name="cross"]').is(':checked'), '', 2); } else{ crossDiv.hide(); toggleMarketingSubmit(false, '', 2); } }); //Opt out clicked, untick other options and hide cross marketing. $("#optout").change(function() { if(this.checked){ updateMarketingCheckboxes($('input.optin:checkbox')); crossDiv.hide(); sureDiv.show(); toggleMarketingSubmit(true, '', 2); } else{ sureDiv.hide(); toggleMarketingSubmit(false, '', 2); } }); //Cross marketing selected, enable button. $('input:radio[name="cross"]').change(function() { if (this.checked) { toggleMarketingSubmit(true, '', 2); } }); //Email Yes/No Step1, enable button. $('input:radio[name="email"]').change(function() { if (this.checked) { toggleMarketingSubmit(true, 1); } }); //Law continue clicked on. $('#prefs_law_continue').click(function () { $('#marketing_prefs_laws').hide(); $('.'+$(this).data( "show" )).show(); document.body.scrollTop = document.documentElement.scrollTop = 0; }); //Two step - email no selected - are you sure? $('.email_optin').change(function(){ if(this.checked && this.value == 'no'){ $('#marketing_prefs_email_optout_check').show(); } else{ $('#marketing_prefs_email_optout_check').hide(); } }); //Two step email chosen. $('#prefs_update1').click(function () { setCookie(stepCookie,$('input:radio[name="email"]:checked').val(),365); $('#marketing_prefs_part1').hide(); $('#marketing_prefs_part2').show(); document.body.scrollTop = document.documentElement.scrollTop = 0; }); //? pressed on mobile. $('#prefs_cross_help').click(function() { var extraModalContainerClass = 'marketing-prefs-casino-family-explanation-popup'; popup( 300, "", ''+decodeURIComponent(($(this).data('help')+'').replace(/\+/g, '%20'))+'
', 'true', 'false', extraModalContainerClass ); }); //Update (all) user settings. $('#prefs_update').click(function () { $('#marketing_prefs_error').hide(); var brandPrefs = {}; var crossPrefs = {}; var brandOptedIn = $('input#optout:checked').length == 0; var crossOptedIn = $('input:radio[name="cross"]:checked').val() == "yes"; var redirect = true; var redirectUrl = $(this).data('redirect-url') || "/"; $('input.optin:checkbox').each(function(){ brandPrefs[this.id] = this.checked; crossPrefs[this.id] = crossOptedIn ? this.checked : false; }); if($(this).data('sender') == 'step2'){ brandPrefs['email'] = $('input:radio[name="email"]:checked').val() == "yes" || typeof cookieVal != 'undefined' ? true : false; crossPrefs['email'] = crossOptedIn ? brandPrefs['email'] : false; } var ack = { 'marketingPrefs' : { 'brandMarketing': brandPrefs, 'crossMarketing': crossPrefs } }; if($('#token').val() != ''){ redirect = false; ack['token'] = $('#token').val(); } callPlatformAPI("user-marketing-update", ack) .done(function(data) { if (data.type == 'error') { showMarketingError(data.message, data.code); } else { removeCookie(stepCookie); if (redirect) { window.location.href = redirectUrl; } else { showMarketingUpdated(); } } }) .fail(function() { showMarketingError('Unknown error occurred.'); }) }); function showMarketingError(msgFallback, code){ const errorMessages = { 306: "Preference not saved: email and/or phone is missing. Please add your details before updating your communication preferences.", 307: "Preference not saved: email and/or phone is missing. Please add your details before updating your communication preferences." } const message = errorMessages[code] || msgFallback $('#marketing_prefs_error_msg').empty(); $('#marketing_prefs_error_msg').append(message); $('#marketing_prefs_error').show(); } function showMarketingUpdated(){ $('.marketing_prefs_succss_hide').hide(); $('#marketing_prefs_success').show(); document.body.scrollTop = document.documentElement.scrollTop = 0; } function toggleMarketingSubmit(toggle, id='', step=""){ toggle = marketingSubmitValidation(toggle, step); var mobileAction = toggle ? 'enable' : 'disable'; if ($.mobile) { //required for jquery mobile! $('#prefs_update'+id).button().button(mobileAction); } else{ $('#prefs_update'+id).prop('disabled', !toggle); } } function updateMarketingCheckboxes(element){ if ($.mobile) { //required for jquery mobile! try{ element.prop('checked', false).checkboxradio('refresh'); }catch(err){ element.prop('checked', false); } }else{ element.prop('checked', false); } } function marketingSubmitValidation(toggle, step) { var twostep = $(".marketing-prefs-two-steps-modal").length > 0; // init variables for step 2 check var optin = $('input.optin:checkbox:checked').length > 0; var optout = $('input#optout:checked').length > 0; var cross = $('input:radio[name="cross"]:checked').length > 0; // if twostep template, step == 2 and one of the selections missing, disable submit. if( twostep && step==2 && !((optin || optout) && cross) ) { toggle = false; } return toggle; } }); $(document).ready(function(){ sendUserDataToApp(); function sendUserDataToApp(){ var data = { "userid" : "", "username" : "" } if ("Android" in window && typeof Android.updateXtremePushData === 'function' && isLoggedIn) { Android.updateXtremePushData(JSON.stringify(data)); } else if(window.webkit && window.webkit.messageHandlers && isLoggedIn){ try{ webkit.messageHandlers.xtremepush.postMessage(data); }catch(err) { console.log('The native context does not exist yet'); } } } });$(document).ready(function() { // MYACCOUNT // Update user notifications $('body').on('change', '#toggleOTPform input[name=otp]', function(event) { event.preventDefault(); $('#toggle-otp-status').text(""); showMainLoader(); // done this way to prevent ide complaints of php syntax in js file, while still serving int var userId = parseInt("0"); var formData = { settings: { "two-factor-required": $('#toggleOTPform input[name=otp]').prop('checked'), }, userId : userId, } callPlatformAPI('user-security-settings/update', formData).then(function (response) { if(response.type != 'error') { setStatusMsg("toggle-otp-status", "Your account details have been successfully updated.", true); } else { setStatusMsg("toggle-otp-status", "There was a problem updating your account details.
Error: Unknown
", true); } }) .fail(function() { setStatusMsg("toggle-otp-status", "There was a problem updating your account details.
Error: Unknown
", true); }) .always(function() { hideMainLoader(); }) }); // OTP PAGE var resendTimer, resendTimerCurrent, resendTimerAmount = 60, otpText = "Send a new code", otpTextTimer = "Send a new code in 60 secs", originalToken, error = { 'error100': "Internal error has occured, please contact support", 'error250': "Token provided is unknown.", 'error251': "Token provided has already been used.", 'error252': "Token provided has been cancelled.", 'error253': "Token provided has expired." } checkToken(); cleanTokens(); $("#resend-otp").on("click", function(event){ event.preventDefault(); if(resendTimerCurrent != undefined) return; $('#error-msg').text(""); var token = $("#otp-form input[name=token]").val(); var payload = { 'token': token // current token to be replaced } callPlatformAPI('auth/2fa-refresh', payload).then(function (response) { if(response.type != "error") { $("#otp-form input[name=token]").val(response.token); // inject new token into token input localStorage.setItem("otp_" + originalToken, response.token); // save to be reloaded if page is refreshed startCountdown(); } else { var errorText = error['error100']; // generic error if(error['error' + response.code]) { // specific response, if we have it errorText = error['error' + response.code]; } $('#error-msg').text(errorText); } }) }) function startCountdown(){ if(resendTimerCurrent != undefined) return; resendTimerCurrent = resendTimerAmount; var resendButton = $('#resend-otp'); resendButton.attr("disabled", 'true'); resendButton.val(otpTextTimer); // preset timer text on button to not wait for 1st tick to change - desktop resendButton.siblings('span').children('span.ui-btn-text').html(otpTextTimer); // preset timer text on button to not wait for 1st tick to change - mobile resendTimer = setInterval(() => { if (resendTimerCurrent > 1) { resendTimerCurrent--; var newTimerText = otpTextTimer.replaceAll(/\d{1,2}/g, resendTimerCurrent); resendButton.val(newTimerText); // replace digits with timer count - desktop resendButton.siblings('span').children('span.ui-btn-text').html(newTimerText); // replace digits with timer count - mobile resendButton.attr("disabled", 'true'); } else { clearInterval(resendTimer); resendButton.val(otpText); // set text to no timer text - desktop resendButton.siblings('span').children('span.ui-btn-text').html(otpText); // set text to no timer text - mobile resendTimerCurrent = undefined; // reset current resendButton.removeAttr("disabled"); } }, 1000); } // if page is refreshed, php post call token will be reloaded, which has since been cancelled on refresh. // load saved refreshed token and insert into token input for use. function checkToken() { originalToken = $("#otp-form input[name=token]").val(); var lsToken = localStorage.getItem("otp_" + originalToken); if(lsToken) { $("#otp-form input[name=token]").val(lsToken); } } // since php handles the login, and does not have access to the localstorage to clear old tokens, // we clear old tokens on load of the otp page. // any otp tokens not associated with token currently being passed by php request is removed function cleanTokens() { var items = { ...localStorage }; var filteredItems = Object.keys(items).filter(item => item.indexOf('otp_') !== -1 && item.indexOf(originalToken) == -1); filteredItems.forEach(function(item) { localStorage.removeItem(item); }) } }); $(function() { var cashierScriptLoaded = false; var eventSet = false; var triggerElement = document.createElement("div") triggerElement.className = "whg-cashier-ui-open"; triggerElement.style.display = "none"; document.body.append(triggerElement); // WITHDRAWALS IN CASHIER console.log("withdrawals in cashier"); var launcher = document.getElementsByTagName("whg-cashier-ui-launcher")[0]; if (typeof(launcher) != 'undefined' && launcher != null) { var config = JSON.parse( launcher.getAttribute("config") ); var withdrawalConfig = { ...config, mode:"withdraw" } var withdrawalTriggerElement = document.createElement("div") withdrawalTriggerElement.className = "whg-cashier-withdrawal-trigger"; withdrawalTriggerElement.style.display = "none"; document.body.append(withdrawalTriggerElement); function buttonClick(e){ e.preventDefault(); e.stopImmediatePropagation(); launcher.setAttribute("config", JSON.stringify(withdrawalConfig) ); if(!cashierScriptLoaded) { $.getScript("https://scontent-wh.whitehatgaming.com/js/whg-cashier-ui-launcher/whg-cashier-ui-launcher.min.js" ,function() { cashierScriptLoaded = true; $('#popupBox').remove(); $('#overlay').hide(); $(withdrawalTriggerElement).trigger('click'); if(!eventSet) { var cashierCloseButton = document.getElementById("cashier-ui-close"); cashierCloseButton.addEventListener("click", function() { launcher.setAttribute("config", JSON.stringify(config)); if (false) { window.postMessage('WHG_BALANCE_REFRESH', '*'); } }); eventSet = true; } }); } else { $(withdrawalTriggerElement).trigger('click'); } } document.body.addEventListener('click', (e) => { const link = e.target.closest('a'); const targetSpan = document.getElementById('withdraw'); if (e.target.matches('a[href="/index.php?page=withdraw"], a[href="index.php?page=withdraw"], a[href*="?page=withdraw"], span#account-withdraw, span#withdraw, a[href*="/withdraw"]' )) { const modalCloseBtn = document.querySelector('#my-account-modal .close'); if (modalCloseBtn) { modalCloseBtn.click(); } buttonClick(e); } else if (e.target instanceof HTMLSpanElement && e.target.parentElement instanceof HTMLAnchorElement && link && link.href.includes('/withdraw')) { buttonClick(e); } else if(e.target.matches('a[href^="/index.php?page=withdraw#"]')){ const modalCloseBtn = document.querySelector('#my-account-modal .close'); if (modalCloseBtn) { modalCloseBtn.click(); } buttonClick(e); } else if (targetSpan && targetSpan.contains(e.target)) { buttonClick(e); } }); } $('body').on('click', 'a[href="/index.php?page=deposit"], a[href="/?page=deposit&gameret=1"], a[href="index.php?page=deposit"], a[href="/deposit"], a[href="/deposit/"], .profile-top-buttons .deposit-btn, .cashier-link', function (e) { e.preventDefault(); e.stopImmediatePropagation(); if(!cashierScriptLoaded){ $.getScript("https://scontent-wh.whitehatgaming.com/js/whg-cashier-ui-launcher/whg-cashier-ui-launcher.min.js", function(data, textStatus, jqxhr) { $('#popupBox').remove(); $('#overlay').hide(); setTimeout(function() { $(triggerElement).trigger('click'); if(!eventSet) { var cashierCloseButton = document.getElementById("cashier-ui-close"); cashierCloseButton.addEventListener("click", function() { if (typeof launcher !== 'undefined' && typeof config !== 'undefined') { launcher.setAttribute("config", JSON.stringify(config)); } if (false) { window.postMessage('WHG_BALANCE_REFRESH', '*'); } }); eventSet = true; } }, 1000); }); cashierScriptLoaded = true; } else { $(triggerElement).trigger('click'); } }); if(window.location.href.search('cashier=1') !== -1 && !window.location.href.includes('/message')) { if (false) { if (!cashierScriptLoaded){ $.getScript("https://scontent-wh.whitehatgaming.com/js/whg-cashier-ui-launcher/whg-cashier-ui-launcher.min.js", function(data, textStatus, jqxhr) { showCashierOnPostmessage(); }); } } else { window.location = "/index.php?page=login&sender=deposit"; } } function showCashierOnPostmessage() { function messageListener(event) { if (event.data == 'cashier-ready') { console.log('post message ready'); $('.whg-cashier-ui-open').trigger('click'); window.removeEventListener('message', messageListener); } } window.addEventListener('message', messageListener, false); console.log('showCashierOnPostmessage'); } }); /** * PhonePrefixSelector - Reusable phone prefix dropdown with caching and search * * @description * Fetches phone prefixes from lookup-service API, caches for 12 hours, * deduplicates by prefix, sorts numerically, and renders to select element. * Optionally supports search filtering and remembers user's last selection. * * @requires LOOKUP_SERVICE_HOST - PHP constant injected via jsutils.php * @requires jQuery * @requires setCookie/getCookie - Global functions from jsutils.php * * @example Basic usage (native select, no search) * const selector = new PhonePrefixSelector({ * selectElement: '#phone_prefix', * defaultCountry: 'GB', * existingPrefix: '44' * }); * * @example With search enabled * // HTML: * // * const selector = new PhonePrefixSelector({ * selectElement: '#phone_prefix', * enableSearch: true, * defaultCountry: 'GB' * }); * * @example Custom cache TTL * const selector = new PhonePrefixSelector({ * selectElement: '#phone_prefix', * cacheTTL: 1440 // Cache for 24 hours instead of default 12 * }); * * @example Get/set values programmatically * const selector = new PhonePrefixSelector({ selectElement: '#phone_prefix' }); * * // Get selected prefix * const prefix = selector.getValue(); // Returns "44" * * // Set prefix programmatically * selector.setValue('1'); // Sets to US +1 * * // Force refresh (flush cache and re-fetch) * selector.refresh(); * * // Cleanup when done * selector.destroy(); * * @param {Object} options Configuration options * @param {string|jQuery} options.selectElement - CSS selector or jQuery element for